// 属性控制规则：值类型 + 值范围
export const DeviceControlRules: Record<string, Record<string, {
  type: 'string' | 'int' | 'float' | 'bool';
  enum?: any[];
  range?: [number, number];
  precision?: number;
}>> = {
  // 小米温湿度计
  'mi_temp_hum_sensor': {
    temperature: { type: 'float', range: [-10, 60] },
    humidity: { type: 'int', range: [0, 100] },
  },

  // 空气质量检测仪
  'mi_air_sensor': {
    pm25: { type: 'int', range: [0, 500] },
    temperature: { type: 'float', range: [-10, 60] },
    humidity: { type: 'int', range: [0, 100] },
  },

  // 空调
  'mi_ac': {
    online: {type: 'bool' },
    power: { type: 'string', enum: ['ON', 'OFF'] },
    target_temperature: { type: 'float', range: [16, 30], precision: 1 },
    mode: { type: 'string', enum: ['cool', 'heat', 'dry', 'fan'] },
    fan_speed: { type: 'string', enum: ['low', 'medium', 'high', 'auto'] },
  },
  'midea_ac': {
    online: {type: 'bool' },
    power: { type: 'string', enum: ['ON', 'OFF'] },
    target_temperature: { type: 'float', range: [16, 30], precision: 1 },
    mode: { type: 'string', enum: ['cool', 'heat', 'dry', 'fan'] },
    fan_speed: { type: 'string', enum: ['low', 'medium', 'high', 'auto'] },
  },

  // 加湿器
  'mi_humidifier': {
    online: {type: 'bool' },
    power: { type: 'string', enum: ['ON', 'OFF'] },
    status: { type: 'string', enum: ['running', 'paused', 'off'] },
    mode: { type: 'string', enum: ['auto', 'sleep', 'strong'] },
    target_humidity: { type: 'int', range: [30, 80] },
  },
  'midea_humidifier': {
    online: {type: 'bool' },
    power: { type: 'string', enum: ['ON', 'OFF'] },
    status: { type: 'string', enum: ['running', 'paused', 'off'] },
    mode: { type: 'string', enum: ['auto', 'sleep', 'strong'] },
    target_humidity: { type: 'int', range: [30, 80] },
  },

  // 除湿器
  'mi_dehumidifier': {
    online: {type: 'bool' },
    power: { type: 'string', enum: ['ON', 'OFF'] },
    mode: { type: 'string', enum: ['auto', 'sleep', 'dry'] },
    target_humidity: { type: 'int', range: [30, 80] },
  },
  'midea_dehumidifier': {
    online: {type: 'bool' },
    power: { type: 'string', enum: ['ON', 'OFF'] },
    mode: { type: 'string', enum: ['auto', 'sleep', 'dry'] },
    target_humidity: { type: 'int', range: [30, 80] },
  },

  // 空气净化器
  'mi_air_purifier': {
    online: {type: 'bool' },
    power: { type: 'string', enum: ['ON', 'OFF'] },
    mode: { type: 'string', enum: ['auto', 'silent', 'strong'] },
    fan_level: { type: 'int', enum: [1, 2, 3] },
  },
  'midea_air_purifier': {
    online: {type: 'bool' },
    power: { type: 'string', enum: ['ON', 'OFF'] },
    mode: { type: 'string', enum: ['auto', 'silent', 'strong'] },
    fan_level: { type: 'int', enum: [1, 2, 3] },
  },
};
